package org.suk.dp.composite;

/**
 * Description: 客户端<br/>
 * @version V1.0  2017/6/21 13:38  by 石冬冬(dongdong.shi@ucarinc.com) - Heil Hitler
 */
public class Client {
    public static void main(String[] args) {
        Composite root = new Composite("root");
        root.add(new Leaf("Leaf A"));
        root.add(new Leaf("Leaf B"));

        Composite comp = new Composite("Composite X");
        root.add(new Leaf("Leaf XA"));
        root.add(new Leaf("Leaf XB"));

        Composite comp2 = new Composite("Composite XY");
        comp2.add(new Leaf("Leaf XYA"));
        comp2.add(new Leaf("Leaf XYB"));
        comp.add(comp2);
        root.add(new Leaf("Leaf C"));

        Leaf leaf = new Leaf("Leaf D");
        root.add(leaf);
        root.remove(leaf);

        root.display(1);
    }
}
